import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 停线类型信息 */
export interface LinestopCategory {
  id: number // 类型id
  name?: string // 类型名称
  code: string // 类型编码
  description?: string // 描述
  parentId?: number // 父id
  children?: LinestopCategory[]
}

// 停线类型 API
export const LinestopCategoryApi = {
  // 查询停线类型列表
  getLinestopCategoryList: async (params) => {
    return await request.get({ url: `/mold/linestop-category/list`, params })
  },

  // 查询停线类型详情
  getLinestopCategory: async (id: number) => {
    return await request.get({ url: `/mold/linestop-category/get?id=` + id })
  },

  // 查询所有停线类型
  getLinestopCategoryAll: async () => {
    return await request.get({ url: `/mold/linestop-category/getAllList` })
  },

  // 新增停线类型
  createLinestopCategory: async (data: LinestopCategory) => {
    return await request.post({ url: `/mold/linestop-category/create`, data })
  },

  // 修改停线类型
  updateLinestopCategory: async (data: LinestopCategory) => {
    return await request.put({ url: `/mold/linestop-category/update`, data })
  },

  // 删除停线类型
  deleteLinestopCategory: async (id: number) => {
    return await request.delete({ url: `/mold/linestop-category/delete?id=` + id })
  },

  // 导出停线类型 Excel
  exportLinestopCategory: async (params) => {
    return await request.download({ url: `/mold/linestop-category/export-excel`, params })
  }
}
